<?php
/**
 * User: 1971229701@qq.com
 * Date: 2020/9/28/028
 * Time: 13:39
 */

namespace app\common\map\ditie;
/**
 * 杭州地铁线
 * Class HangzhouMetro
 * @package app\common\map\ditie
 */
class HangzhouMetro
{
    public function hangzhou()
    {
        $url = 'http://map.amap.com/service/subway?_1601261111051&srhdata=3301_drw_hangzhou.json';
        $res = json_decode(file_get_contents($url), true);
        $l = $res['l'];
        $data = [];
        foreach ($l as $key => $val) {
            $kn = $val['kn'];
            $data[]['line'] = $kn;
            foreach ($val['st'] as $value) {
                $data1[] = ['name' => $value['n'], 'sl' => $value['sl']];
                $data[$key]['list'] = $data1;
            }
        }
        halt($data);
    }
}